home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12160 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.ov.com!news
  2. From: glenn@ov.com (Fletcher.Glenn@ov.com)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP - malloc
  5. Date: 29 Mar 1996 17:15:18 GMT
  6. Organization: OpenVision
  7. Message-ID: <4jh5r6$d56@spanky.pls.ov.com>
  8. References: <1996Mar27.143834.6017@leeds.ac.uk>
  9. Reply-To: glenn@ov.com
  10. NNTP-Posting-Host: foghorn.pls.ov.com
  11.  
  12. In article 6017@leeds.ac.uk, csyamc@scs.leeds.ac.uk (A M Casey) writes:
  13. >I pass this character string into a function, defined as
  14. >
  15. >ItemName *char
  16. >
  17. >and I have already allocated memory (ItemName=malloc(50)) and
  18. >set it to a value. It gets into the function fine, but when I call
  19. >another function, passing ItemName to it, the function changes it
  20. >to become nothing, although I dont see why. The function which is
  21. >called does use malloc to allocate memory for other strings, but shouldnt
  22. >change ItemName in any way.
  23. >
  24. >Has malloc overwritten my previously defined string or something?
  25. >
  26. >
  27. >PLEASE PLEASE PLEASE help
  28. >
  29. >cheers
  30. >
  31. >Andy
  32. >
  33. >
  34.  
  35.  
  36. malloc() has been debugged for eons, it is unlikely to cause the problems
  37. you describe.  It is more likely that your code is exceeding the boundaries
  38. of the memory you have allocated.  In the absence of your code, it is 
  39. impossible to say where this is occurring.
  40.  
  41.             Fletcher.Glenn@ov.com
  42.  
  43.  
  44.